class Solution(object):
    def dayOfYear(self, date):
        """
        :type date: str
        :rtype: int
        """
        s = [int(w) for w in date.split('-')]
        if s[0] % 4 != 0:
            state = 0
        else:
            if s[0] % 100 != 0:
                state = 1
            else:
                if s[0] % 400 == 0:
                    state = 1
                else:
                    state = 0
        t = 0
        for m in range(1, s[1]):
            if m in {1,3,5,7,8,10}:
                t += 31
            else:
                if m in {4, 6, 9, 11}:
                    t += 30
                else:
                    if state:
                        t += 29
                    else:
                        t += 28
        return t + s[2]




data = Solution()
